package com.example.petproject.entity.vo;

import com.github.pagehelper.Page;

import java.util.List;

/**
 * 包名称：com.example.petproject.entity.vo
 * 类名称：PageResult
 * 类描述：分页查询结果展示实体类
 * 创建人：@author DrinkMore-HotWater
 * 创建时间：2024年01月10日 09:43
 **/
public class PageResult<T> {

    private Integer pageNo;
    private Integer pageSize;
    private Long total;
    private Integer pages;

    private List<T> list;

    public static <T> PageResult<T> ok(Page page) {
        return new PageResult<T>(page.getPageNum(), page.getPageSize(), page.getTotal(), page.getPages(), page.getResult());

    }

    PageResult(Integer pageNo, Integer pageSize, Long total, Integer pages, List<T> list) {
        this.pageNo = pageNo;
        this.pageSize = pageSize;
        this.total = total;
        this.pages = pages;
        this.list = list;
    }

    public Integer getPageNo() {
        return pageNo;
    }

    public void setPageNo(Integer pageNo) {
        this.pageNo = pageNo;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    public Integer getPages() {
        return pages;
    }

    public void setPages(Integer pages) {
        this.pages = pages;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }
}
